<template>
	<view class="">
		<view class="" style="height: calc(100rpx + env(safe-area-inset-bottom) / 2);" v-if="isPla">

		</view>
		<view class="cu-bar tabbar bg-white foot">
			<!-- 首页 -->

			<view class="action" :class='{active: item.path == path}' v-for='item in list' @click='toPage(item)'>
				<image class='icon' :src='path == item.path? item.sicon : item.icon'></image>
				<text>{{item.name}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import util from '@/common/util'
	export default {
		props: {
			path: String,
			loginType: '',
			isPla: {
				type: Boolean,
				default: true
			}
		},
		computed: {
		},
		watch: {
			loginType: {
				handler(newVal, oldVal) {
					this.userType = newVal
				},
				// 开启深度监听
				deep: true
			}
		},
		data() {
			return {
				userType: undefined,
				list:[
					{
						name: '宠物',
						path: '/pages/pet/index/saler',
						icon: "https://vdigit-shop.oss-cn-zhangjiakou.aliyuncs.com/20250106/202501061200273610.png",
						sicon: "https://vdigit-shop.oss-cn-zhangjiakou.aliyuncs.com/20250106/202501061200319640.png"
					},
					{
						name: "服务",
						path: "/pages/pet/service/saler",
						icon: "https://vdigit-shop.oss-cn-zhangjiakou.aliyuncs.com/20250106/202501061200447922.png",
						sicon: "https://vdigit-shop.oss-cn-zhangjiakou.aliyuncs.com/20250106/202501061200503123.png"
					},
					{
						name: "客户",
						path: "/pages/pet/client/index",
						icon: "https://vdigit-shop.oss-cn-zhangjiakou.aliyuncs.com/20250106/202501061201041681.png",
						sicon: "https://vdigit-shop.oss-cn-zhangjiakou.aliyuncs.com/20250106/202501061201090020.png"
					},
					{
						name: "客服",
						path: "",
						icon: "https://vdigit-shop.oss-cn-zhangjiakou.aliyuncs.com/20250109/202501091510158155.png",
						sicon: "https://vdigit-shop.oss-cn-zhangjiakou.aliyuncs.com/20250109/202501091509478192.png"
					},
					{
						name: "我的",
						path: "/pages/pet/myPet/index",
						icon: "https://vdigit-shop.oss-cn-zhangjiakou.aliyuncs.com/20250106/202501061201202795.png",
						sicon: "https://vdigit-shop.oss-cn-zhangjiakou.aliyuncs.com/20250106/202501061201233202.png"
					},
				],
			}
		},
		created() {
			// uni.$on('pet_change_loginType', (e) => {
			// 	this.userType = e;
			// })
			// this.userType = uni.getStorageSync('loginType') || 'CARGO';
		},
		beforeDestroy() {
			// uni.$off('pet_change_loginType')
		},
		methods: {
			toPage(item) {
				uni.redirectTo({
					url: item.path
				})
				// if (item.module == 'PROCURE') {
				// 	util.navigateTo({
				// 		url: item.path
				// 	})
				// }else if (item.module == 'CARGO_C_MASTER') {
				// 	util.navigateTo({
				// 		url: '/pages/pet/masterPlat/index'
				// 	})
				// } else if (item.module == 'CARGO_C_SUPPORT') {
				// 	wx.openCustomerServiceChat({
				// 		extInfo: {
				// 			url: uni.getStorageSync('platInfo').svrChat
				// 		},
				// 		corpId: uni.getStorageSync('platInfo').corpId,
				// 		success(res) {},
				// 		fail(res) {
				// 			console.log(res)
				// 		},
				// 	})
				// } else {
				// 	this.$emit('handlePath', item.path)
				// }
				// if(this.path === item.path) return;
				// uni.redirectTo({
				// 	url: item.path
				// })
			}
		}
	}
</script>

<style scoped lang="scss">
	.tabbar {

		.action {
			display: flex;
			flex-direction: column;
			align-items: center;
			font-family: PingFang SC;
			font-size: 24rpx;
			font-weight: 500;

			&.active {
				font-variation-settings: "opsz" auto;
				// background: linear-gradient(292deg, #FF7B1C 11%, #FF1403 89%);
				background: var(--primaryBg);
				-webkit-background-clip: text;
				-webkit-text-fill-color: transparent;
				background-clip: text;
			}

			.icon {
				width: 48rpx;
				height: 48rpx;
				margin-bottom: 4rpx;
			}
		}
	}
</style>